package com.rppowell.pixie.models;

import java.awt.Dimension;
import java.awt.Rectangle;

public class Map {
    private SpriteSet spriteSet;
    private String name;

    private Sprite[][] sprites;
    private Dimension imageSize;
    private Dimension mapSize;

    public Map(SpriteSet s, int w, int h, String name) {
        this.spriteSet = s;
        this.name = name;
        SpriteSetProperties p = spriteSet.getSpriteSetProperties();
        mapSize = new Dimension(w, h);
        imageSize = new Dimension(p.getSpriteWidth() * w, p.getSpriteHeight() * h);
        fillRect(new Rectangle(0, 0, mapSize.width, mapSize.height), null);
    }
        
    private void fillRect(Rectangle r, Sprite s) {
        int x, y, w, h;
        x = 0;
        y = 0;
        w = r.width;
        h = r.height;
        sprites = new Sprite[h][w];
    }
    
    public void setName(String name) {
        this.name = name;
    }
    public String getName() {
        return this.name;
    }
    
    public Dimension getImageSize() {
        return imageSize;
    }
    public Dimension getMapSize() {
        return mapSize;
    }
    
    public SpriteSet getSpriteSet() {
        return spriteSet;
    }
    public Sprite getSprite(int i, int j) {
        return sprites[j][i];
    }
    public void setSprite(int i, int j, Sprite s) {
        sprites[j][i]=s;
    }   
}
